//
//  DDTNewFeatureViewController.swift
//  weibo
//
//  Created by mac on 16/9/30.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

private let reuseIdentifier = "Cell"

class DDTNewFeatureViewController: UICollectionViewController {

    
    let layout = UICollectionViewFlowLayout()
    init() {
        super.init(collectionViewLayout: layout)
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

       
        
        self.collectionView!.registerClass(DDTNewFeatureViewCell.self, forCellWithReuseIdentifier: reuseIdentifier)

        prepareLayout()
        
    }
    
    
   func prepareLayout() {
    layout.itemSize = self.view.bounds.size
    layout.minimumInteritemSpacing = 0
    layout.minimumLineSpacing = 0
    layout.scrollDirection = UICollectionViewScrollDirection.Horizontal
    
    collectionView?.showsHorizontalScrollIndicator = false
    collectionView?.pagingEnabled = true
    collectionView?.bounces = false
    
    }
    
    
    // MARK: UICollectionViewDataSource

    override func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return newFeatureCount
    }

    override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as! DDTNewFeatureViewCell
    
        // Configure the cell
        cell.imageIndex = indexPath.item
    
        return cell
    }


    
    

   
}
